<div style="min-height: 300px; padding-bottom: 20px; width: 98%; float: left" class="portlet x12">
	<div class="portlet-header">
		<h4>Thêm link
		</h4>

	</div>	<!-- .portlet-header -->

		<?php foreach($dulieu as $row) {
			$id = $row['id'];
			$ten = $row['ten_link'];
			$link = $row['link'];
			$type = $row['type'];
		?>


	    <?php echo form_open('admin/links/do_sua_link','enctype="multipart/form-data"');?>
          <input type="hidden" name="id_de_sua" value="<?php echo $id; ?>"/>

		  <div style='position:relative;top:20px;margin-left:10px;'>
                <label for="fname"><b>Tên link : </b></label>
				<div style='position:relative;bottom:23px;left:80px;'><input type="text" name="ten_link" value='<?php echo $ten; ?>' size="35"/></div>
		  </div>

          <div style='position:relative;top:20px;margin-left:10px;'>
                <label for="fname"><b>link : </b></label>
				<div style='position:relative;bottom:23px;left:80px;'>
					<input type="text" name="link" value='<?php echo $link; ?>' size="35"/>
		  		</div>
  		</div>


		  <div style='position:relative;top:20px;margin-left:10px;'>
                <label for="fname"><b>Loại liên kết : </b></label>
				<div style='position:relative;bottom:23px;left:80px;'>
					<select id="type" name="type" onchange="addImage(this.value);">
						<option <?php echo ($type==''?'selected="selected"':'') ?> value="">Lựa chọn</option>
						<option <?php echo ($type=='website'?'selected="selected"':'') ?> value="website">Website</option>
						<option <?php echo ($type=='facebook'?'selected="selected"':'') ?> value="facebook">Facebook</option>
						<option <?php echo ($type=='twitter'?'selected="selected"':'') ?> value="twitter">Twitter</option>
						<option <?php echo ($type=='flickr'?'selected="selected"':'') ?> value="flickr">Flickr</option>
					</select>
				</div>
		 	</div>
			<div style='position:relative;top:20px;margin-left:10px;<?php echo ($type=='website'?'':'display:none;') ?>' id="link_image">
                <label for="fname"><b>Hình ảnh :</b></label>
				<div style='position:relative;bottom:23px;left:70px;'><input type="file" name="img" /></div>
		  	</div>
		  <div class="buttonrow" style='position:relative;top:20px;left:150px;'>
					 <button class="btn btn-orange">Save</button>
		  </div><!-- end .buttonrow -->
		</form>
		<?php } ?>

</div>	<!-- .portlet x12 -->
<script type="text/javascript">
function addImage(value){
	if(value=='website'){
		document.getElementById("link_image").style.display="";
	}else{
		document.getElementById("link_image").style.display="none";
	}
}
</script>